<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class WeiboController extends Controller {

    public function login() {
        if ($this->isPost()) {
            $weibo = new Weibo($this->post('username'), $this->post('password'));
            if (!empty($_GET['act'])) {
                $act = $_GET['act'];
                $weibo->$act();
            } else {
                $weibo->pre_login();
            }
        } else {
            $this->display('weibo/add');
        }
    }
    
    public function getweibos() {
        $weibo = new Weibo();
        print_r($weibo->request_url('http://weibo.com/comment/outbox?wvr=6&pids=plc_main&ajaxpagelet=1&ajaxpagelet_v6=1&__ref=%2Fcomment%2Finbox%3Ftopnav%3D1%26wvr%3D6%26f%3D1&_t=FM_1475129599589126', array(), '', '', 0, 0, 'cookie2070033817'));
    }

    public function sendWeibo() {
        $weibo = new Weibo();
        $post = array(
            "title" => "有什么新鲜事想告诉大家",
            "location" => "page_100505_home",
            "text" => "eee",
            "appkey" => '',
            "style_type" => 1,
            "pic_id" => '',
            "pdetail" => "1005055057764465",
            "rank" => 1,
            "rankid" => '',
            "pub_source" => "page_2",
            "longtext" => 1,
            "topic_id" => '1022:',
            "pub_type" => "dialog",
            "_t" => 0
        );
        print_r($weibo->request_url('http://weibo.com/p/aj/v6/mblog/add?ajwvr=6&domain=100505&__rnd=1475129613100', $post, '', '', 0, 0, 'cookie2070033817'));
    }

}
